package com.epigeon.amadeo.test;

import android.app.Dialog;
import android.content.Context;

import com.epigeon.amadeo.engine.Engine;
import com.epigeon.amadeo.impl.PassiveEditText;

public class SettingsDialog extends Dialog {
	
	public static final String TAG_TEXT_HOST = "text_host";
	public static final String TAG_TEXT_PORT = "text_port";
	public static final String TAG_TEXT_SERVICE = "text_service";
	public static final String TAG_TEXT_USER = "text_user";
	public static final String TAG_TEXT_PASSWORD = "text_password";
	public static final String TAG_BUTTON_CONNECT = "button_connect";

    public SettingsDialog(Context context) {
		super(context);
	}

	protected void onStart() {
        super.onStart();
        setContentView(R.layout.settings);
        getWindow().setFlags(4, 4);
        setTitle("XMPP Settings");
                
        PassiveEditText hostText = (PassiveEditText) findViewById(R.id.host);
        PassiveEditText portText = (PassiveEditText) findViewById(R.id.port);
        PassiveEditText serviceText = (PassiveEditText) findViewById(R.id.service);
        PassiveEditText userText = (PassiveEditText) findViewById(R.id.userid);
        PassiveEditText passwordText = (PassiveEditText) findViewById(R.id.password);
        
        ActiveConnectButton connectButton = (ActiveConnectButton) findViewById(R.id.ok);

        connectButton.addPassiveInput(hostText);
        connectButton.addPassiveInput(portText);
        connectButton.addPassiveInput(serviceText);
        connectButton.addPassiveInput(userText);
        connectButton.addPassiveInput(passwordText);
        
        Engine.getInstance().registerInput(TAG_TEXT_HOST, hostText);
        Engine.getInstance().registerInput(TAG_TEXT_PORT, portText);
        Engine.getInstance().registerInput(TAG_TEXT_SERVICE, serviceText);
        Engine.getInstance().registerInput(TAG_TEXT_USER, userText);
        Engine.getInstance().registerInput(TAG_TEXT_PASSWORD, passwordText);
        Engine.getInstance().registerInput(TAG_BUTTON_CONNECT, connectButton);
                
    }

}
